package com.wxq.shape;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;

public class MapPath extends MapShape {

	protected Path mPath;
	
	public MapPath(Path mPath) {
		super();
		this.mPath = mPath;
		Path newPath = new Path();
		newPath.addPath(mPath);
		setDrawPath(newPath);
	}
	
	public MapPath(Path path,float xOffset, float yOffset) {
		this(path);
		offset(xOffset, yOffset);
	}
	
	@Override
	public void zoom(Matrix scale) {
		Path newPath = new Path();
		newPath.addPath(mPath);
		setDrawPath(newPath);
		getDrawPath().transform(scale);
	}

	@Override
	public void draw(Canvas canvas, Paint paint) {
		drawPath.offset(xOffset, yOffset);
		canvas.drawPath(drawPath, paint);
		drawPath.offset(-xOffset, -yOffset);
	}
}
